<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    canvas {
      display: block;
      margin: 0 auto;
      border: 1px solid #000;
    }
  </style>
</head>

<body>
  <canvas height="300" width="1080"></canvas>
</body>
<script>
  function draw() {
    var canvas = document.querySelector('canvas')
    var ctx = canvas.getContext('2d')
    var x = 0
    function move() {
      ctx.save()
      ctx.clearRect(0, 0, canvas.width, canvas.height)
      ctx.translate(-x, 0)
      ctx.drawImage(bgImage, 0, 0)
      ctx.drawImage(bgImage, canvas.width, 0)
      x++
      if (x > canvas.width) {
        x = 0
      }
      window.requestAnimationFrame(move)
      ctx.restore()
    }
    var bgImage = new Image()
    bgImage.src = "image/1.jpg"
    bgImage.onload = function () {
      move()
    }
  }
  draw()
</script>

</html>